<?php

namespace App\Admin\Controllers;

use App\Models\IndexHtmlModel;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class IndexHtmlController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '友情链接';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new IndexHtmlModel());

        $grid->column('id', __('Id'));
        //$grid->column('hot_phone','热线电话');
        $grid->column('link','友情链接');
    /*    $grid->column('encyclopedias','百科');
        $grid->column('problem','常见问题');*/
        $grid->column('created_at', __('Created at'));
        $grid->column('updated_at', __('Updated at'));
        $grid->disableCreateButton();
        $grid->disableFilter();
        $grid->disableExport();

        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(IndexHtmlModel::findOrFail($id));

        $show->field('id', __('Id'));
        //$show->field('hot_phone','热线');
        $show->field('link','友情链接');
        /*$show->field('encyclopedias','百科');
        $show->field('problem','常见问题');*/
        $show->field('created_at', __('Created at'));
        $show->field('updated_at', __('Updated at'));

        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new IndexHtmlModel());


       // $form->number('hot_phone','热线');
        $form->url('link','友情链接');
/*        $form->editor('encyclopedias','百科');
        $form->editor('problem','常见问题');*/

        return $form;
    }
}
